import 'package:fish_redux/fish_redux.dart';

class MessageState implements Cloneable<MessageState> {
  String id;
  String title;
  String content;
  String type;
  String tip;
  bool read = false;
  String actionUrl;
  String creationTime;

  MessageState(
      {this.id,
      this.title,
      this.content,
      this.type,
      this.tip,
      this.read,
      this.actionUrl,
      this.creationTime});

  factory MessageState.fromJson(Map<String, dynamic> json) {
    return MessageState(
      id: json['id'],
      title: json['title'],
      content: json['content'],
      type: json['type'],
      tip: json['tip'],
      read: json['read'],
      actionUrl: json['actionUrl'],
      creationTime: json['creationTime'],
    );
  }

  @override
  MessageState clone() {
    return MessageState()
      ..id = id
      ..title = title
      ..content = content
      ..type = type
      ..tip = tip
      ..read = read
      ..actionUrl = actionUrl
      ..creationTime = creationTime;
  }

  @override
  String toString() {
    return 'MessageState{title: $title}';
  }
}
